<template>
  <view class="container">
    <uni-calendar :insert="true" :lunar="true" @change="handleCalendarChange" />

    <view class="list">
      <view class="course-info" v-for="(item, index) in classList" :key="index">
        <view class="time">{{ item.start_time.slice(11, 16) }}</view>
        <view class="line"></view>
        <view class="class">
          <view class="course-name">{{ item.course_type[0].name }}课</view>
          <view class="teacher-info"
            ><text>{{ item.name }}</text
            ><text>地址：{{ item.location[0].name }}</text>
          </view>
        </view>
      </view>
    </view>
  </view>
</template>
<script>
import { getTeacherDetail } from '@/api/class_share';
export default {
  data() {
    return {
      eventId: '',
      classList: [],
    };
  },
  methods: {
    handleCalendarChange(date) {},
  },
  onLoad(options) {
    this.eventId = options.id;
    getTeacherDetail({ id: this.eventId } || 1)
      .then(res => {
        this.classList = res.schedule_info;
        console.log(res);
      })
      .catch(error => {
        console.error('请求失败:', error);
      });
  },
};
</script>
<style lang="scss" scoped>
.container {
  background: #f8f8f8;
  padding: 32rpx 24rpx;
}

.course-info {
  margin: 24rpx 0;
  padding: 32rpx;
  display: flex;
  align-items: center;
  background: #ffffff;
  border-radius: 20rpx;
}
.line {
  width: 6rpx;
  height: 76rpx;
  background: #0dc160;
  border-radius: 4rpx;
  margin: 0 24rpx 0 35rpx;
}
.time {
  font-size: 32rpx;
  font-weight: bold;
}
.course-name {
  font-size: 28rpx;
  margin: 10rpx 0;
}

.teacher-info {
  font-size: 24rpx;
  color: #666;
}
</style>
